AnimationHelper

open class AnimationHelper

Provides utility methods for creating and running common View animations. This class simplifies tasks such as fading views in or out, and translating views to new positions on the screen.

Example usage for fading a view in:


View myView = findViewById(R.id.my_view);
AnimationHelper.fadeIn(myView, 500); // Fades in over 500 milliseconds

See also

Functions

Link copied to clipboard
open fun fadeIn(@NonNull target: View)
Fades in the target View from fully transparent (alpha 0) to fully opaque (alpha 1) using the default duration of {@value #DEFAULT_FADE_DURATION} milliseconds.
open fun fadeIn(@NonNull target: View, duration: Long)
open fun fadeIn(@NonNull target: View, duration: Long, @Nullable listener: Animator.AnimatorListener)
Fades in the target View from fully transparent (alpha 0) to fully opaque (alpha 1).
Link copied to clipboard
open fun fadeOut(@NonNull target: View)
Fades out the target View from fully opaque (alpha 1) to fully transparent (alpha 0) using the default duration of {@value #DEFAULT_FADE_DURATION} milliseconds.
open fun fadeOut(@NonNull target: View, duration: Long)
open fun fadeOut(@NonNull target: View, duration: Long, @Nullable listener: Animator.AnimatorListener)
Fades out the target View from fully opaque (alpha 1) to fully transparent (alpha 0).
Link copied to clipboard
open fun translate(@NonNull target: View, leftTo: Float, topTo: Float, duration: Long, @Nullable listener: Animator.AnimatorListener)
Translates (moves) the target View to the specified screen coordinates.